<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <title>绑定小区</title>
    <#assign base=request.contextPath />
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link href="${base}/css/mui.min.css" rel="stylesheet" />
    <link rel="stylesheet"  href="${base}/frame/layui/css/layui.css"  >

    <link rel="stylesheet" type="text/css" href="${base}/css/style.css" />
    <link rel="stylesheet" type="text/css" href="${base}/fonts/iconfont.css"/>
    <link rel="stylesheet" href="${base}/frame/layui/css/layui.css?t=1534970980648" media="all">
    <script src="${base}/js/jquery.js"></script>
    <script src="${base}/fonts/iconfont.js" ></script>
    <script src="${base}/frame/layui/layui.js" charset="utf-8"></script>

    <style type="text/css">
        .ired {
            color: red;
        }

        .mui-btn-block {
            padding: 6px 0;
        }

        .mui-icon-arrowthindown {
            font-size: 14px;
            color: #007aff;
            font-weight: bold
        }

        .info_list {
            width: 100%;
            background-color: #f2f2f2;
            height: 40px;
            border-bottom: 1px solid #F2F2F2;
        }

        .list_left2 {
            width: 97%;
            margin-left: 3%;
            height: 40px;
            font-family: "微软雅黑";
            font-size: 13px;
            color: #000000;
            line-height: 40px;
            float: left;
            margin-bottom: 14px;
        }

        .list_left2 span {
            color: #A04E52;
            font-size: 10px;
            margin-left: 5px;
        }

        .id_img_wp {
            width: 94%;
            margin: 0 auto;
            min-height: 30px;
        }

        .img_wp {
            width: 40%;
            margin: 0 5% 0 5%;
            float: left;
            cursor: pointer;
        }

        .img_wp img {
            width: 100%;
            height: 100%;
        }

        .img_intro {
            color: #383838;
            text-align: center;
            font-family: "微软雅黑";
            padding: 10px 0 10px 0;
        }

        .mui-input-row {
            border-top: 1px solid #F2F2F2;
        }

        .mui-table-view:after {
            display: none;
        }

        .col2 {
            background-color: #F2F2F2;
        }

        .van-popup {
            background: none;
            color: white;
        }

        .van-overlay {
            display: none;
            background-color: rgba(0, 0, 0, 0.29);
        }
        .mui-badge1{
            padding:0px; width:65%; float:right; line-height:42px; font-size:14px;
        }
        .layui-input layui-unselect{
            width: 100%;
            height: 30px;
        }
    </style>
</head>
<body>

<input type="hidden" value="${user.id}" id="id">



<div>
    <form class="layui-form" >
        <div class="layui-form-item" >
            <label class="layui-form-label" style="padding-right: 23px; padding-top: 16px;">选择框</label>
            <div class="layui-input-inline" style="width: 240px;height: 19px;margin-top: 10px;">
                <select name="quarters" id="quarters" lay-verify="required"   lay-search="">
                    <option value="">请选择..</option>
                <#list quarters as quarters>
                <option value="${quarters.id}">${quarters.quartersName}</option>
                </#list>
                </select>
            </div>
        </div>
    </form>
</div>
<div class="mui-content">



    <#--<div class="layui-form-item">-->
        <#--<div class="layui-inline">-->
            <#--<label class="layui-form-label">选择小区</label>-->
            <#--<div class="layui-input-inline">-->
                <#--<select name="modules" lay-verify="required" lay-search="">-->
                    <#--<option value="">请选择...</option>-->
               <#--<#list quarters as quarters>-->
				    <#--<option value="${quarters.id}">${quarters.quartersName}</option>-->
               <#--</#list>-->
                <#--</select>-->
            <#--</div>-->
        <#--</div>-->
    <#--</div>-->

    <#--<div class="mui-input-group">-->
        <#--<div class="mui-input-row">-->
            <#--<label>选择小区</label>-->
            <#--<a class="mui-navigate-right">-->
			<#--<span class="mui-badge1">-->
			<#--<select class="mui-h5" id="quarters" style="margin:auto; color:#000;">-->
				<#--<option value="">请选择</option>-->
				<#--<#list quarters as quarters>-->
				    <#--<option value="${quarters.id}">${quarters.quartersName}</option>-->
				<#--</#list>-->
			<#--</select>-->
			<#--</span>-->
            <#--</a>-->
        <#--</div>-->
    <#--</div>-->

    <div class="mui-input-row">
        <label>楼层室</label>
        <input type="text" id="detailedFloor" placeholder="请输入几楼几层几室">
    </div>

    <div class="mui-input-row">
        <label>手机号</label>
        <input type="number" id="tel" placeholder="请输入手机号">
    </div>

    <div class="mui-card-footer">
        <button type="button" data-loading-icon="mui-spinner mui-spinner-custom"
                class="mui-btn mui-btn-blue mui-btn-block">立即提交
        </button>
    </div>

</div>
<div class="van-overlay" id="loading">
    <div class="van-popup"><i style="font-size: 40px;"
                              class="layui-icon layui-anim layui-anim-rotate layui-anim-loop layui-icon-loading"></i>
    </div>
</div>
<script src="${base}/js/mui.js"></script>
<#--<script type="text/javascript">-->


    <#--document.getElementById('indexlist').addEventListener('tap', function() {-->
        <#--mui.openWindow({-->
            <#--url: '${base}/wx/user/index',-->
            <#--id: 'main'-->
        <#--});-->

    <#--});-->
    <#--document.getElementById('repair').addEventListener('tap', function() {-->
        <#--mui.openWindow({-->
            <#--url: '${base}/wx/user/repair',-->
            <#--id: 'main'-->
        <#--});-->

    <#--});-->

    <#--document.getElementById('personal').addEventListener('tap', function() {-->
        <#--mui.openWindow({-->
            <#--url: '${base}/wx/user/personal',-->
            <#--id: 'main'-->
        <#--});-->

    <#--});-->

<#--</script>-->
<script>
    layui.use(['form' ], function() {
        var form = layui.form
    });
</script>

<script type="text/javascript">
    mui(document.body).on('tap', '.mui-btn', function (e) {
        var jsonDate = {};
        jsonDate.quartersId = $("#quarters").val();
        jsonDate.tel = $("#tel").val();
        jsonDate.detailedFloor = $("#detailedFloor").val();
        jsonDate.id = $("#id").val();
        if ($("#quarters").val() == "") {
            mui.alert("请选择小区");
            return;
        }
        if (!(/^1(3|4|5|6|7|8|9)\d{9}$/.test($("#tel").val()))) {
            mui.alert("手机号格式不对");
            return;
        }

        if ($("#detailedFloor").val() == "") {
            mui.alert("请填写楼层室");
            return;
        }
        $.ajax({
            type: "POST",
            url: "${base}/wx/user/updateByIdUser",
            data: {param: JSON.stringify(jsonDate)},
            async: true,
            beforeSend: function () {
                ShowDiv();
            },
            success: function (data) {
                if (data.code === 0) {
                    //mui.alert('提交成功')
                    setTimeout(function () {
                        window.location.href = "${base}/wx/user/bindingSuccess.html";
                    }, 300)
                } else {
                    mui.alert(data.msg)
                }
            },
            complete: function () {
                HiddenDiv();
            }
        });
    });

    //显示加载数据
    function ShowDiv() {
        $("#loading").show();
    }

    //隐藏加载数据
    function HiddenDiv() {
        $("#loading").hide();
    }
</script>
</body>
</html>
